using UnityEngine;

public class MenuVisualEffectController : MonoBehaviour
{
	public GameObject visualObject;

	[SerializeField]
	private CharacterInformation[] demoPlayers;

	[SerializeField]
	private Map demoMap;

	public Color[] playerColors;

	public Game game;

	public GameObject[] topPanel;

	public bool CanPlaySound()
	{
		GameObject[] array = topPanel;
		foreach (GameObject gameObject in array)
		{
			if (gameObject.activeSelf)
			{
				return false;
			}
		}
		return true;
	}

	public void Show(bool start)
	{
		visualObject.SetActive(value: true);
		for (int i = 0; i < demoPlayers.Length; i++)
		{
			demoPlayers[i].name = "DemoPlayer" + i;
			demoPlayers[i].SetColor(playerColors[i]);
			game.SetCharacterLayer(demoPlayers[i].gameObject, 9 + i);
			demoPlayers[i].GetComponent<AIController>().enabled = true;
			demoPlayers[i].GetComponent<AIController>().RegisterEnemies(demoPlayers);
			demoPlayers[i].GetComponent<CharacterHealth>().Respawn();
			if (start)
			{
				demoPlayers[i].GetComponent<AIController>().ResetDelay();
			}
			demoPlayers[i].DeFreeze();
		}
	}

	public void Hide()
	{
		for (int i = 0; i < demoPlayers.Length; i++)
		{
			demoPlayers[i].Freeze();
		}
		visualObject.SetActive(value: false);
	}
}
